/**
 * 直播间实时到课数据
 * @author hanzhichen (hanzhichen@baijia.com)
 * @date 2021-03-07
 */

import React, {useState, useEffect} from 'react';
import {getReportIdList} from '~/service/reports';
import Part1 from './part1';
import Part2 from './part2';

import './index.styl';

const RealTimeAttend = props => {
    const {
        match: {
            params: {id}
        }
    } = props;
    const [idList, setIdList] = useState([]);
    const [id1, id3] = idList || [];

    useEffect(() => {
        if (id) {
            // 查询报表id.
            getReportIdList(id).then(res => {
                const {
                    data: {idList = []} = {}
                } = res || {};
                setIdList(idList || []);
            });
        }
    }, [id]);
    return (
        <div className="real-time-attend">
            <Part1 id1={id1} />
            <Part2 id3={id3} />
        </div>
    );
};

export default RealTimeAttend;
